package com.yejhxt.receive;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.ibatis.session.SqlSession;

import com.yejhxt.inter.deviceMapper;
import com.yejhxt.inter.messageMapper;
import com.yejhxt.inter.roleMapper;
import com.yejhxt.model.device;
import com.yejhxt.model.message;
import com.yejhxt.receive.receive.SaveThread;

public class MyListener  implements ServletContextListener{

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		new Thread(new EndThread()).start();
		
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {

		new Thread(new StartThread()).start();
	}
	 static class StartThread implements Runnable{

			@Override
			public void run() {
				receive.init();
				
			}
			 
			 
			 
		 } 
	 static class EndThread implements Runnable{

			@Override
			public void run() {
				receive.shutdown();
				
			}
			 
			 
			 
		 } 

}
